package com.imti.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.imti.dao.DepSysDao;
import com.imti.dao.DeskWorkDao;
import com.imti.entity.DepSys;
import com.imti.entity.DeskWork;
import com.imti.entity.dto.DepSysDto;
import com.imti.service.DepSysService;
import com.imti.service.DeskWorkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 科室系统表(DepSys)表服务实现类
 *
 * @author makejava
 * @since 2023-02-03 13:59:19
 */
@Service("depSysService")
public class DepSysServiceImpl extends ServiceImpl<DepSysDao, DepSys> implements DepSysService {

    @Autowired
    private DepSysDao depSysDao;

    @Autowired
    private DeskWorkDao deskWorkDao;


    @Override
    public List<DepSysDto> findDepsysDeskwork(String searchName) {
        List<DepSysDto> depSyss=depSysDao.findDepsysDeskwork(searchName);
       for (DepSysDto depSys:depSyss){
           Integer byDeskId=depSys.getDepSysId();
           depSys.setDeskWorks(deskWorkDao.ByDeskId(byDeskId,searchName));
        }

//        for(int i=0;i<depSyss.size();i++){
//          Integer x=depSyss.get(i).getDepSysId();
//            //List<DeskWork> deskWorks=deskWorkDao.ByDeskId(x);
//           depSyss.get(i).setDeskWorks(deskWorkDao.ByDeskId(x));
//        }

        return depSyss;
    }
}

